/**
 *
 */
package com.cmcc.pcap.packet.pcap;

import com.google.common.hash.HashCode;
import com.cmcc.pcap.packet.util.CommonUtils;

/**
 * @Date 2018年1月16日 下午4:22:20
 * @author Amish
 *
 */
public class PcapPacketHeader {
	
	public PcapFileHeader pcapFileHeader;
	
	public byte[] timestamp_second;
	public byte[] timestamp_microsecond;
	public byte[] caplen;
	public byte[] len;
	
	/**
	 * TODO 仅仅用来生成Pcap Packet Header ，可以根据传入参数，参数为空时用默认值生成
	 * @return
	 */
	public static PcapPacketHeader encode(){
		PcapPacketHeader pph = new PcapPacketHeader();
		
		pph.timestamp_second = CommonUtils.reverseBytes(HashCode.fromString("11111111".toLowerCase()).asBytes());
		pph.timestamp_microsecond = CommonUtils.reverseBytes(HashCode.fromString("11111111".toLowerCase()).asBytes());
		pph.caplen = CommonUtils.reverseBytes(HashCode.fromString("11111111".toLowerCase()).asBytes());
		pph.len = CommonUtils.reverseBytes(HashCode.fromString("11111111".toLowerCase()).asBytes());
		
		return pph;
	}

}
